package com.itheima.file;

import java.io.File;

public class Demo3 {
    public static void main(String[] args) {
        File file=new File("C:\\Users\\Lenovo\\Desktop\\src");
             deleteDir(file);

    }

    private static void deleteDir(File file) {
        File[] files = file.listFiles();
        if(files!=null){
            for (File file1 : files) {
                if(file1.isFile()){
                    file1.delete();
                }else{
                    deleteDir(file1);
                }
            }

        }
    }
}
